<?php

namespace app\admin\model\yunfood;

/**
 * 参数
 */
class FoodParam extends \addons\yunfood\model\FoodParam
{
    // 自定义初始化
    protected static function init()
    {
        self::beforeWrite(function ($record) {
            $scenario = $record->data['scenario'] ?? null;
            if ($scenario) {
                if ($record->data['type'] == self::TYPE_ADDON) {
                    $record->items = $record->food_ids;
                }
            }
        });
    }
}
